import request from '@/utils/request'
import type { ResultList, BaseInfo } from '@/@types/index.type'

export interface Role extends BaseInfo {
  roleId?: number
  roleName?: string
  status?: '0' | '1'
}
export interface RoleDTO extends Role {
  menuIds?: number[]
}

export const addRole = (data: any) => request.post('/system/role', data)

export const deleteRole = (id: number) => request.delete('/system/role/' + id)

export const getRole = (id: number) => request.get<RoleDTO>('/system/role/' + id)

export const updateRole = (id: number, data: RoleDTO) => request.put('/system/role/' + id, data)

export const getRoleList = (data: any) => request.get<ResultList<any>>('/system/role', data)

export const getAllRole = () => request.get<Role[]>('system/role/all')
